<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件通信-父组件向子组件传递数据</title>
</head>
<script src="../js/vue.js"></script>
<body>

<div id="app">
    <cpn :cmovies="movies" :cmsg="msg"></cpn>
</div>

</body>

<template id="cpn">
    <div>
        <h1>{{cmovies}}</h1>
        <h2>{{cmsg}}</h2>
    </div>
</template>

<script>
    const vue = new Vue({
        'el': '#app',
        'data': {
            msg: 'qaqaqaq',
            movies: ['1', '2', '3']
        },
        'methods': {},
        components: {
            'cpn': {
                template: cpn,
                // props: ['cmovies', 'cmsg'],
                props: {
                    // cmovies: Array,
                    // cmsg: String,

                    cmsg: {
                        type: String,
                        default: 'aaa',
                        required: true
                    },
                    cmovies: {
                        type: Array,
                        default() {
                            return []
                        },
                        required: true
                    }
                }
            }
        }
    })
</script>
</html>